set nocompatible
source $VIMRUNTIME/vimrc_example.vim
"source $VIMRUNTIME/mswin.vim
"behave mswin

"""""""""""自定义开始""""""""""""

"内码使用utf8，优先以utf8尝试解码
set encoding=utf8
set fencs=utf8,cp936
if $LANG =~ "UTF" || $LANG =~ "utf"
    set termencoding=utf8
else
    set termencoding=cp936
endif

"通用的一些样式
sy on
colorscheme wf
"colorscheme wf2
set laststatus=2
set nobk
set statusline=%F\ [%{&fenc}\ %{&ff}\ %l/%L]
"缩进使用的空白数
set shiftwidth=4
"文件中的tab代表的空格数
set tabstop=4
"插入tab时使用合适数量的空格
"set noexpandtab
set expandtab
"开启新行时使用智能自动缩进
set autoindent
set foldmethod=marker
set number
"set cursorline

"下面这句是为了让较长的行显示
set display=lastline

"配置TOhtml生成的代码格式
let use_xhtml = 1
let html_use_css = 1
"是否需要强制显示行号
"let html_number_lines = 1

"修正文件类型
autocmd BufNewFile,BufRead *.tpl,*.htm,tplt set filetype=html

"设置markdown语法高亮
autocmd BufNewFile,BufRead *.text set filetype=mkd

"编辑文本文件时，tab不要变成空格
autocmd BufNewFile,BufRead *.txt,*.text,*.data set noexpandtab

"设置自动完成词典
autocmd Filetype javascript set dictionary+=$vim/vimfiles/directory/tangram
autocmd Filetype javascript,html,html set dictionary+=$vim/vimfiles/directory/javascript
autocmd Filetype php set dictionary+=$vim/vimfiles/directory/php

"每次编辑完.vimrc文件时立刻加载
"autocmd BufWritePost *vimrc :source $MYVIMRC

"<F12>快速编辑.vimrc
map <F12> :e $MYVIMRC<CR>

"窗口切换
map <F5> <C-W>h
map <F6> <C-W>j
map <F7> <C-W>k
map <F8> <C-W>l
map <C-tab> <C-W>w


"""""""""" GUI设置 """"""""""""
if has('gui_running')
    "只出现右边的滚动条即可
	set guioptions=cr
else
    "取消鼠标支持，这样终端可以复制文本
    set mouse=
endif


""""""""" Unix vim 配置 """""""""
if has('unix')


endif


""""""""" windows gvim设置 """"""""
if has('win32') || has('win64')

	"设置交换文件路径
	set dir=c:/tmp

	"按F5调用系统默认程序打开文件
	nnoremap <silent> <F9> :let old_reg=@"<CR>:let @"=substitute(expand("%:p"), "/", "\\", "g")<CR>:silent!!cmd /cstart <C-R><C-R>"<CR><CR>:let @"=old_reg<CR>
	nmap <F6> :update<CR>:silent !start f:\progra~1\intern~1\iexplore.exe file://%:p<CR>
	map <C-tab> <C-W>w
	
	"最大化 字体
	au GUIEnter * simalt ~x
	set guifont=Consolas:h10.15
    
    "防止菜单发生乱码
    set langmenu=zh_CN
    let $LANG = 'zh_CN.UTF-8'
    source $VIMRUNTIME/delmenu.vim
    source $VIMRUNTIME/menu.vim

endif




"插件配置
"
"tag list配置
"autocmd BufNewFile,BufRead *.py,*.c,*.h :TlistOpen

"配置netrw插件更好的浏览目录
let g:netrw_altv      = 1
let g:netrw_winsize   = 23
let g:netrw_liststyle = 3

"NerdTree
map <F4> :NERDTreeToggle<RETURN>
imap <F4> <ESC>:NERDTreeToggle<RETURN>

"acp插件调用snipptMate定义的东东
let g:acp_behaviorSnipmateLength = 1

"注释插件的配置
function g:acommentSet()
    let g:acomment = {}
    let g:acomment["user"] = 'shen zhou(shenzhou1982@gmail.com)'
    let g:acomment['cTop'] = [
                \ [["          File:  ",'Y'],[expand("%"),'N']]
                \,[["        Author:  ",'Y'],[g:acomment["user"],'T']]
                \,[["      Modifier:  ",'Y'],[g:acomment["user"],'SIGN']]
                \,[["      Modified:  ",'Y'],[strftime("%Y-%m-%d %H:%M:%S")."  ",'N']]
                \,[["   Description:  ",'N'],["",'Y']]
                \,[["     Copyright:  ",'N'],["(c) 2011-2021 baidu.inc",'Y']]
                \]
endfunction

"SVN插件映射
map <leader>sd <Plug>VCSDiff
map <leader>sv <Plug>VCSVimDiff
map <leader>si <Plug>VCSInfo
map <leader>su <Plug>VCSUpdate
map <leader>sc <Plug>VCSCommit
map <leader>sa <Plug>VCSAdd
map <leader>st <Plug>VCSStatus
